<template>
  <div class="page_header">
    <div class="page_header_div">
      <div>
        <img
          src="@/assets/img/login/nav_ic_back_dark@2x.png"
          alt=""
          style="width: 44px;height: 44px;"
          v-show="showImg"
          @click="setClick ? click() : goBack()"
        />
        <span
          :style="showImg ? '' : 'margin-left:14px'"
          class="page_header_title"
          >{{ title }}</span
        >
      </div>
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'page-header',
  props: {
    title: {
      type: String,
      default: ''
    },
    showImg: {
      type: Boolean,
      default: true
    },
    setClick: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {}
  },
  methods: {
    click () {
      this.$emit('click')
    },
    goBack () {
      this.$router.back()
    }
  }
}
</script>

<style lang="scss" scoped>
.page_header {
  width: 100%;
  height: 44px;
  background: #ffffff;
  .page_header_div {
    display: flex;
    align-items: center;
    width: 100%;
    background: #ffffff;
    padding: 0 20px 0 14px;
    box-sizing: border-box;
    height: 44px;
    z-index: 99;
    position: fixed;
    top: 0;
    justify-content: space-between;
    div {
      display: flex;
      align-items: center;
    }
    .page_header_title {
      font-size: 17px;
      font-weight: 600;
      text-align: left;
      color: #39404d;
      line-height: 20px;
      flex: 1;
    }
  }
}
</style>
